//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_weaprespawn2.sqf"
#include "xr_macros.sqf"

__pSetVar [QGVARXR(hasusedmapclickspawn), true];
_p = player;
/*removeAllItems _p;
removeAllWeapons _p;
{__addmx} forEach __pGetVar(GVARXR(magazines));
{__addwx} forEach __pGetVar(GVARXR(weapons));
_primw = primaryWeapon _p;
if (_primw != "") then {
	_p selectWeapon _primw;
	_muzzles = getArray(configFile/"cfgWeapons"/_primw/"muzzles");
	_p selectWeapon (_muzzles select 0);
};
#ifdef __OAXR__
if (!isNull (unitBackpack _p)) then {removeBackpack _p};
if (__pGetVar(GVARXR(ubp)) != "") then {
	_p addBackpack __pGetVar(GVARXR(ubp));
	_bp = unitBackpack _p;
	clearMagazineCargoGlobal _bp;
	clearWeaponCargoGlobal _bp;
	if (count (__pGetVar(GVARXR(oabackpackmags)) select 0) > 0) then {
		_mags = __pGetVar(GVARXR(oabackpackmags)) select 0;
		_mcount = __pGetVar(GVARXR(oabackpackmags)) select 1;
		{_bp addMagazineCargoGlobal [_x, _mcount select _forEachIndex]} forEach _mags;
	};
	if (count (__pGetVar(GVARXR(oabackpackweaps)) select 0) > 0) then {
		_weaps = __pGetVar(GVARXR(oabackpackweaps)) select 0;
		_mcount = __pGetVar(GVARXR(oabackpackweaps)) select 1;
		{_bp addWeaponCargoGlobal [_x, _mcount select _forEachIndex]} forEach _weaps;
	};
};
#endif
*/
// TODO